ga.view.aerial
Class AerialEvaluationState<T extends IIndividual<T>>

java.lang.Object
  extended by com.jme3.app.state.AbstractAppState
      extended by ga.view.appstate.RootNodeState
          extended by ga.view.appstate.SceneState
              extended by ga.view.aerial.AerialEvaluationState<T>
Type Parameters:
T - The generic type of the individuals.
All Implemented Interfaces:
com.jme3.app.state.AppState, IFitnessEvaluator<T>, IInteractiveFitnessEvaluator<T>, IMenuListenerParent

public class AerialEvaluationState<T extends IIndividual<T>>
extends SceneState
implements IInteractiveFitnessEvaluator<T>, IMenuListenerParent

This interactive evaluator provides an aerial view on the show room. There are also 5 buttons for assigning fitness.

Since:
12.08.2012
Author:
Stephan Dreyer

Nested Class Summary
private  class AerialEvaluationState.ViewSwitchListener
          Keyboard listener to switch the perspective.
 
Field Summary
private  ISIGA<T> algorithm
           
private  com.jme3.app.Application app
           
private  CameraSettings camSettings
           
private  CamDragListener dragListener
           
private  T individual
           
private  java.util.List<EvaluationListener<T>> listeners
           
private static java.util.logging.Logger LOGGER
           
private  MenuListener menuListener
           
private  IPhenotypeGenerator<T,? extends com.jme3.scene.Spatial> phenotypeGenerator
           
private  com.jme3.system.AppSettings settings
           
private  ShowRoomFactory showRoomFactory
           
private  AerialUIState<T> uiState
           
 
Fields inherited from class ga.view.appstate.SceneState
assetManager, cam, inputManager, renderManager, stateManager, timer, viewPort
 
Fields inherited from class ga.view.appstate.RootNodeState
rootNode
 
Fields inherited from class com.jme3.app.state.AbstractAppState
initialized
 
Constructor Summary
AerialEvaluationState(IPhenotypeGenerator<T,? extends com.jme3.scene.Spatial> phenotypeGenerator)
          Creates a new aerial evaluation state.
 
Method Summary
 void addEvaluationListener(EvaluationListener<T> listener)
          Adds an EvaluationListener that will be notified about the evaluation state.
 void cleanup()
           
 void evaluate(T individual)
          Evaluates the given individual.
 void fireIndividualEvaluated(T individual)
          Notification method that causes all EvaluationListeners being notified that the evaluator has evaluated the individual.
 void fireNewIndividualRequested()
          Notification method that causes all EvaluationListeners being notified that the evaluator demands a new individual for evaluation.
 ISIGA<T> getAlgorithm()
          Getter for the interactive genetic algorithm.
 CamDragListener getDragListener()
          Gets the drag listener.
private  void initCam()
          Configures the camera.
 void initialize(com.jme3.app.state.AppStateManager stateManager, com.jme3.app.Application app)
           
 void removeEvaluationListener(EvaluationListener<T> listener)
          Adds an EvaluationListener.
 void setAlgorithm(ISIGA<T> algorithm)
          Sets the interactive genetic algorithm.
 void setEnabled(boolean enabled)
           
 void setMenuListener(MenuListener menuListener)
          Sets the menu listener.
 
Methods inherited from class ga.view.appstate.SceneState
finalCleanUp, getCamera
 
Methods inherited from class ga.view.appstate.RootNodeState
getRootNode, update
 
Methods inherited from class com.jme3.app.state.AbstractAppState
isEnabled, isInitialized, postRender, render, stateAttached, stateDetached
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

phenotypeGenerator

private final IPhenotypeGenerator<T extends IIndividual<T>,? extends com.jme3.scene.Spatial> phenotypeGenerator

showRoomFactory

private ShowRoomFactory showRoomFactory

uiState

private AerialUIState<T extends IIndividual<T>> uiState

listeners

private final java.util.List<EvaluationListener<T extends IIndividual<T>>> listeners

camSettings

private CameraSettings camSettings

menuListener

private MenuListener menuListener

settings

private com.jme3.system.AppSettings settings

dragListener

private CamDragListener dragListener

algorithm

private ISIGA<T extends IIndividual<T>> algorithm

individual

private T extends IIndividual<T> individual

app

private com.jme3.app.Application app
Constructor Detail

AerialEvaluationState

public AerialEvaluationState(IPhenotypeGenerator<T,? extends com.jme3.scene.Spatial> phenotypeGenerator)
Creates a new aerial evaluation state. This must not be called directly, the configuration parser will instantiate this class.

Parameters:
phenotypeGenerator - The phenotype generator.
Since:
12.08.2012
Method Detail

setMenuListener

public void setMenuListener(MenuListener menuListener)
Description copied from interface: IMenuListenerParent
Sets the menu listener.

Specified by:
setMenuListener in interface IMenuListenerParent
Parameters:
menuListener - the new menu listener

initialize

public void initialize(com.jme3.app.state.AppStateManager stateManager,
                       com.jme3.app.Application app)
Specified by:
initialize in interface com.jme3.app.state.AppState
Overrides:
initialize in class SceneState

cleanup

public void cleanup()
Specified by:
cleanup in interface com.jme3.app.state.AppState
Overrides:
cleanup in class RootNodeState

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface com.jme3.app.state.AppState
Overrides:
setEnabled in class SceneState

initCam

private void initCam()
Configures the camera.

Since:
12.08.2012

setAlgorithm

public void setAlgorithm(ISIGA<T> algorithm)
Description copied from interface: IInteractiveFitnessEvaluator
Sets the interactive genetic algorithm.

Specified by:
setAlgorithm in interface IInteractiveFitnessEvaluator<T extends IIndividual<T>>
Parameters:
algorithm - The SIGA.

getAlgorithm

public ISIGA<T> getAlgorithm()
Description copied from interface: IInteractiveFitnessEvaluator
Getter for the interactive genetic algorithm.

Specified by:
getAlgorithm in interface IInteractiveFitnessEvaluator<T extends IIndividual<T>>
Returns:
The SIGA.

evaluate

public void evaluate(T individual)
Description copied from interface: IFitnessEvaluator
Evaluates the given individual.

Specified by:
evaluate in interface IFitnessEvaluator<T extends IIndividual<T>>
Specified by:
evaluate in interface IInteractiveFitnessEvaluator<T extends IIndividual<T>>
Parameters:
individual - Individual to evaluate.

fireNewIndividualRequested

public void fireNewIndividualRequested()
Description copied from interface: IInteractiveFitnessEvaluator
Notification method that causes all EvaluationListeners being notified that the evaluator demands a new individual for evaluation.

Specified by:
fireNewIndividualRequested in interface IInteractiveFitnessEvaluator<T extends IIndividual<T>>

fireIndividualEvaluated

public void fireIndividualEvaluated(T individual)
Description copied from interface: IInteractiveFitnessEvaluator
Notification method that causes all EvaluationListeners being notified that the evaluator has evaluated the individual.

Specified by:
fireIndividualEvaluated in interface IInteractiveFitnessEvaluator<T extends IIndividual<T>>
Parameters:
individual - The evaluated individual.

addEvaluationListener

public void addEvaluationListener(EvaluationListener<T> listener)
Description copied from interface: IInteractiveFitnessEvaluator
Adds an EvaluationListener that will be notified about the evaluation state.

Specified by:
addEvaluationListener in interface IInteractiveFitnessEvaluator<T extends IIndividual<T>>
Parameters:
listener - The listener.

removeEvaluationListener

public void removeEvaluationListener(EvaluationListener<T> listener)
Description copied from interface: IInteractiveFitnessEvaluator
Adds an EvaluationListener.

Specified by:
removeEvaluationListener in interface IInteractiveFitnessEvaluator<T extends IIndividual<T>>
Parameters:
listener - The listener.

getDragListener

public CamDragListener getDragListener()
Gets the drag listener.

Returns:
the drag listener